package com.membership.cloud.web.model;

import com.membership.cloud.exception.ServerTechnicalException;
import com.membership.cloud.jpa.domain.NameDescPersistable;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Persistable;

import java.util.List;

/**
 * Created by hiephn on 2014/07/12.
 */
public interface DataPageResponse<ENT extends Persistable<Integer>, RES extends IDResponse<ENT>> {

    void from(List<ENT> list, Class<RES> responseClass) throws InstantiationException, IllegalAccessException, ServerTechnicalException;
    void from(Page<ENT> page, Class<RES> responseClass) throws InstantiationException, IllegalAccessException, ServerTechnicalException;
    void from(ENT entity, Class<RES> responseClass) throws InstantiationException, IllegalAccessException, ServerTechnicalException;

    void dataListFrom(List<ENT> list, Class<RES> responseClass) throws IllegalAccessException, InstantiationException, ServerTechnicalException;
    void dataListFrom(Page<ENT> page, Class<RES> responseClass) throws IllegalAccessException, InstantiationException, ServerTechnicalException;
}
